//
//  BXGNineGridView.m
//  CommunityPrj
//
//  Created by apple on 2017/9/1.
//  Copyright © 2017年 itheima. All rights reserved.
//

#import "BXGNineGridView.h"
#import <Masonry/Masonry.h>

@interface BXGNineGridView()
@property(nonatomic, strong) NSMutableArray *arrImageView;
@end

@implementation BXGNineGridView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

-(void)setImages:(NSArray*)images andViews:(NSArray*)views
{
    NSAssert(images.count==views.count, @"images count is not match with views frame count");
    if(images)
    {
        NSArray*subViews = self.subviews;
        for(UIView *item in subViews)
        {
            [item removeFromSuperview];
        }
        
        int i=0;
        for (NSString* image in images) {
            UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:image]];
            imageView.frame = ((UIView*)views[i]).frame;
            [self addSubview:imageView];
            i++;
        }
        
    }
}

@end
